aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/[username]/receive/+page.server.js
blob: 0203285ebfa1d31409305933cb8f7f8473854a84 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
import getRates from "$lib/rates";
import { redirect } from "@sveltejs/kit";

export const load = async ({ cookies, params: { username }, parent, url }) => {
	const token = cookies.get("token");
	const rates = await getRates();
	if (!token) redirect(307, `/pay/${username}`);
	const { subject } = await parent();
	return {
		rate: rates[subject.currency],
		text: `${username}@${url.host}`,
	};
};